package com.mysky.client.mvp.audioplayer;

import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PushButton;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
import com.google.web.bindery.event.shared.EventBus;
import com.gwtplatform.mvp.client.ViewImpl;
import com.kiouri.sliderbar.client.solution.simplehorizontal.SliderBarSimpleHorizontal;
import com.kiouri.sliderbar.client.view.SliderBar;

public class WidgetAudioView extends ViewImpl implements
		WidgetAudioPresenter.MyView {

	private final Widget widget;

	public interface Binder extends UiBinder<Widget, WidgetAudioView> {
	}

	@Inject
	public WidgetAudioView(final EventBus eventBus, final Binder binder) {
		super();
		int sliderBarWidth = 300; // px
		sliderBar = new SliderBarSimpleHorizontal(sliderBarWidth, sliderBarWidth+"px", false);
		widget = binder.createAndBindUi(this);
		sliderBarPanel.add(sliderBar);
	}

	@Override
	public Widget asWidget() {
		return widget;
	}
	
	@UiField
	PushButton playButton;

	@Override
	public PushButton getPlayButton() {
		return playButton;
	}
	
	@UiField
	Label audioUrl;

	@Override
	public Label getAudioUrl() {
		return audioUrl;
	}

	@UiField
	Label audioInfo;

	@Override
	public Label getAudioInfo() {
		return audioInfo;
	}

	@UiField
	HTMLPanel sliderBarPanel;
	
	SliderBar sliderBar;

	@Override
	public SliderBar getSliderBar() {
		return sliderBar;
	}

}
